package com.ymatou.iapi.godfreight.service;

import java.math.BigDecimal;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*商品详细页显示商品默认运费Call
*FreeMaker Template自动生成代码
*/
public class getProductDefaultFreightCall extends YmatouBaseCall{
	private static String opurl ="/getProductDefaultFreight";
	
	public getProductDefaultFreightCall() {
		super(EnvSetup.getSystemUrl("godfreight_api"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	public String getData()
    {
        return getString("data");
    }
    
	public String getSuccess() throws JSONException
    {
        return getString("success");
    }
	
	public String getRequestId() throws JSONException
    {
        return getString("requestId");
    }

    public BigDecimal  getdefaultFreight() throws JSONException
    {
        return getJsonObject().get("data").getAsJsonObject().get("defaultFreight").getAsBigDecimal();
    }
    
    public String  getCurrency() throws JSONException
    {
        return getJsonObject().get("data").getAsJsonObject().get("freightCurrency").getAsString();
    }
}